package com.jinghua.treatment.service.impl;

import com.jinghua.treatment.entity.SysPatient;
import com.jinghua.treatment.mapper.SysPatientMapper;
import com.jinghua.treatment.service.SysPatientService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 患者业务接口实现类
 * Created by 王兴光 on 2018/3/16.
 */
@Service("patientService")
public class SysPatientServiceImpl implements SysPatientService {

    @Resource
    private SysPatientMapper patientMapper;

    @Override
    public List<SysPatient> selectByDoctorId(Integer doctorId) {
        return patientMapper.selectBydoctorId(doctorId);
    }

    @Override
    public List<SysPatient> selectByWeek(Integer doctorId) {
        return patientMapper.selectByTime(doctorId);
    }

    @Override
    public List<SysPatient> selectByName(Integer doctorId, String patientName) {
        return patientMapper.selectByName(doctorId,patientName);
    }

    @Override
    @Transactional
    public int insert(SysPatient record) {
        return patientMapper.insert(record);
    }

    @Override
    @Transactional
    public int updateByPrimaryKey(SysPatient record) {
        return patientMapper.updateByPrimaryKey(record);
    }

    @Override
    public int selectPatientCount(Integer doctorId) {
        return patientMapper.selectPatientCount(doctorId);
    }

    @Override
    public SysPatient selectById(Integer patientId) {
        return patientMapper.selectByPrimaryKey(patientId);
    }
}
